/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author niit
 */
@Entity
@Table(name = "fl_faculty")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FlFaculty.findAll", query = "SELECT f FROM FlFaculty f"),
    @NamedQuery(name = "FlFaculty.findByFacultyid", query = "SELECT f FROM FlFaculty f WHERE f.facultyid = :facultyid"),
    @NamedQuery(name = "FlFaculty.findByName", query = "SELECT f FROM FlFaculty f WHERE f.name = :name"),
    @NamedQuery(name = "FlFaculty.findByAddress", query = "SELECT f FROM FlFaculty f WHERE f.address = :address")})
public class FlFaculty implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "facultyid")
    private Integer facultyid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "address")
    private String address;
    @JoinColumn(name = "memberid", referencedColumnName = "memberid")
    @ManyToOne(optional = false)
    private FlMember memberid;
    @JoinColumn(name = "courseid", referencedColumnName = "courseid")
    @ManyToOne(optional = false)
    private FlCourse courseid;
    @OneToMany(mappedBy = "facultyid")
    private List<FlQuery> flQueryList;

    public FlFaculty() {
    }

    public FlFaculty(Integer facultyid) {
        this.facultyid = facultyid;
    }

    public FlFaculty(Integer facultyid, String name, String address) {
        this.facultyid = facultyid;
        this.name = name;
        this.address = address;
    }

    public Integer getFacultyid() {
        return facultyid;
    }

    public void setFacultyid(Integer facultyid) {
        this.facultyid = facultyid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public FlMember getMemberid() {
        return memberid;
    }

    public void setMemberid(FlMember memberid) {
        this.memberid = memberid;
    }

    public FlCourse getCourseid() {
        return courseid;
    }

    public void setCourseid(FlCourse courseid) {
        this.courseid = courseid;
    }

    @XmlTransient
    public List<FlQuery> getFlQueryList() {
        return flQueryList;
    }

    public void setFlQueryList(List<FlQuery> flQueryList) {
        this.flQueryList = flQueryList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (facultyid != null ? facultyid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FlFaculty)) {
            return false;
        }
        FlFaculty other = (FlFaculty) object;
        if ((this.facultyid == null && other.facultyid != null) || (this.facultyid != null && !this.facultyid.equals(other.facultyid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.FlFaculty[ facultyid=" + facultyid + " ]";
    }
    
}
